/* Űº¸µå·ÎºÎÅÍ ÀÔ·ÂµÈ ¹®ÀÚ¿­À» ÀÐ°í ±×°ÍÀ» µð½ºÅ©¿¡ ±â·ÏÇÑ´Ù. ÇÁ·Î±×·¥Àº »ç¿ëÀÚ°¡ °ø¹é ¶óÀÎÀ» ÀÔ·ÂÇÒ ¶§ Á¾·áµÈ´Ù. ÇÁ·Î±×·¥À» ½ÇÇàÇÒ ¶§ ¸í·É¾î ¶óÀÎ(command line)¿¡ Ãâ·Â È­ÀÏÀÇ À̸§À» ¸í½ÃÇØ¾ß ÇÑ´Ù. */ #include #include #include int main(int argc, char *argv[]) { /* if (argc != 2) { cout << "Usage : WRITE \n"; return 1; } */ ofstream out(argv[1]); // Á¤»óÀûÀÎ Ãâ·Â È­ÀÏ /* if (!out) { cout << "Cannot open output file. \n"; return 1; } */ char str[80]; cout << "Write strings to disk, RETURN to stop\n"; do { cout << " : "; gets(str); out << str << endl; } while (*str); out.close(); return 0; }